﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using LabelPrint;

namespace DIProject.ReceptionGoods
{
    public partial class ShtrihInfo : Form
    {
        private DataSets.waybillsData.SZDataDetailRow _row;
        /// <summary>
        /// партия которую печетаем
        /// </summary>
        public DataSets.waybillsData.SZDataDetailRow RowForPrint
        {
            get { return _row; }
            set { _row = value; }
        }
        public Int32 Count
        {
            get 
            {
                string str = txbCount.Text;
                if (string.IsNullOrEmpty(str))
                    return 0;
                Int32 res;
                if (Int32.TryParse(str, out res))
                {
                    if (res <= 0)
                        return 0;
                    return res;
                }
                return 0;
            }
        }

        public ShtrihInfo(DataSets.waybillsData.SZDataDetailRow ddr)
        {
            InitializeComponent();
            RowForPrint = ddr;
        }

        private void ShtrihInfo_Load(object sender, EventArgs e)
        {
            txbCount.Text = this.RowForPrint.RestQntty.ToString();
            lbBarCode.Text = this.RowForPrint.BarCode;
            lbGoods.Text = this.RowForPrint.FullName;
        }

        private void txbCount_Validating(object sender, CancelEventArgs e)
        {
            TextBox tb = sender as TextBox;
            if (tb != null)
                e.Cancel = !Util.Validator.Int32Validation(tb, "Введите целое число");
        }
    }
}